package day4;
//测试Object类
public class TestObject {
    public static void main(String[] args) {
//        TestObject t = new TestObject();
        //第一类:对象类
        TestObject t1 = new TestObject();
        TestObject t2 = t1;
        TestObject t3 = new TestObject();
        System.out.println("t1:"+t1.hashCode());
        System.out.println("t2:"+t2.hashCode());
        System.out.println("t3:"+t3.hashCode());
        //第二类：基本类型封装类 Integer Long Byte Float ...
        Integer num = 1000;
        Integer num2 = new Integer(1000);
        Long num3 = 1000l;
        System.out.println("num:"+num.hashCode());
        System.out.println("num2:"+num2.hashCode());
        System.out.println("num3:"+num3.hashCode());
        //第三类：String类,可能会出现个bug
        //哈希冲突：值是不同的，但是hashcode反而相同
        String s1 = "java";
        String s2 = new String("java");
        System.out.println("s1:"+s1.hashCode());
        System.out.println("s2:"+s2.hashCode());
        String s3 = "重地";
        String s4 = "通话";
        System.out.println("s3:"+s3.hashCode());
        System.out.println("s4:"+s4.hashCode());
    }
}
